package com.taocore.top.title.action;

import java.sql.Connection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.taocore.top.title.db.DBUtils;
import com.taocore.top.title.db.Dao;

public class OtherWordsAction extends ActionBase{

	static Logger _log = Logger.getLogger(OtherWordsAction.class.getName());
	
	private static final String[] WORDS = {
		"促销", "特价", "打折", "折扣", "包邮", "零利润", "回馈", 
		"全场", "清仓", "买一送一", "假一赔十", "正品", "质量", "七天包退", "VIP"};
	
	private List<String> customWords;
	
	public String execute()
	{
		long userId = getUserId();
		Connection conn = null;
		try
		{
			conn = DBUtils.getConnection();
			customWords = Dao.INSTANCE.getCustomWords(userId, conn);
		}
		catch (Exception e) {
			_log.log(Level.SEVERE, "", e);
		}
		finally
		{
			DBUtils.close(conn, null, null);
		}
		return SUCCESS;
	}
	
	public String[] getWords()
	{
		return WORDS;
	}

	public void setCustomWords(List<String> customWords) {
		this.customWords = customWords;
	}

	public List<String> getCustomWords() {
		return customWords;
	}
}
